package tw.twandroidproj.app.ui.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import tw.twandroidproj.app.R;

/**
 * Created by Lin on 2016/5/21.
 */
public class applicant_list extends AppCompatActivity{
    private RecyclerView mRecyclerView;
    private List<String> mDatas;
    private HomeAdapter mAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.applicant_list);
        initData();
        mRecyclerView = (RecyclerView) findViewById(R.id.applicant_list);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
        mRecyclerView.setAdapter(mAdapter = new HomeAdapter());
    }

    protected void initData()
    {
        mDatas = new ArrayList<String>();
        for (int i = 'A'; i < 'z'; i++)
        {
            mDatas.add("" + (char) i);
        }
    }

    class HomeAdapter extends RecyclerView.Adapter<HomeAdapter.MyViewHolder>
    {

        @Override
        public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
        {
            MyViewHolder holder = new MyViewHolder(LayoutInflater.from(
                    applicant_list.this).inflate(R.layout.applicant_list_item, parent,
                    false));
            return holder;
        }

        @Override
        public void onBindViewHolder(MyViewHolder holder, int position)
        {
            holder.name.setText(mDatas.get(position));
            holder.lookup=(Button)findViewById(R.id.lookup);
            holder.yes=(Button)findViewById(R.id.yes);
            holder.no=(Button)findViewById(R.id.no);

        }

        @Override
        public int getItemCount()
        {
            return mDatas.size();
        }

        class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
        {

            TextView name;
            Button lookup,yes,no;

            public MyViewHolder(View view)
            {
                super(view);
                name = (TextView) view.findViewById(R.id.applicant_name);
            }

            @Override
            public void onClick(View view) {


                }

            }
        }
    }


